package com.zkkj.demo.vo.base;

import com.zkkj.demo.enume.RightEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;

/**
 * author : cyc
 * Date : 2019/12/25
 */

@Data
@ApiModel(value = "返回结果(分页)")
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class ResultVo<T> extends BaseResultVo<T> {

    @ApiModelProperty(name = "total", value = "总数")
    private int total;

    public ResultVo() {
    }

    public ResultVo(int code, String desc, T data, int total) {
        super(code, desc, data);
        this.total = total;
    }

    public AResultVo<T> successPage(T t, int count) {
        AResultVo<T> aResultVo = new ResultVo<>(RightEnum.RES_SUCCESS.getCode(), RightEnum.RES_SUCCESS.getDesc(), t, count);
        return aResultVo;
    }
}
